<template>
  <div>
    <SearchAndTable
      :searchData="searchData"
      :operateData="operateData"
      :columns="columns"
      ref="table"
    />
  </div>
</template>

<script>
import SearchAndTable from '@/components/SearchAndTable/index'
import { getTableData } from '@/api/app'
export default {
  name: 'member',
  components: {
    SearchAndTable
  },
  data () {
    return {
      searchData: [],
      operateData: [],
      columns: [
        {
          title: '用户名',
          align: 'center',
          minWidth: 120,
          key: 'name'
        },
        {
          title: '手机号',
          align: 'center',
          minWidth: 120,
          key: 'phone'
        },
        {
          title: '登录次数',
          align: 'center',
          minWidth: 150,
          key: 'count'
        }
      ]
    }
  },
  methods: {
    async getTableData (page, size) {
      let res = await getTableData(page, size)
      if (res.message) {
        this.$router.push('/login')
      }
      if (res.data) {
        let { content: data, total } = res.data
        return { data, total }
      } else {
        this.$Message.error(res.message)
        return { data: [], total: 0 }
      }
    }
  }
}
</script>

<style lang="" scoped>
</style>
